import { Observer } from "mobx-vue"
import { Component, Vue } from "vue-property-decorator";
import { getDepartmentList } from 'src/utils/axios'
import PubArea from 'src/views/components/pubArea/pubArea.vue';
@Observer
@Component({
  props: {
    clear: {
      type: Boolean,
      default: false
    }
  },
  components: {
    PubArea
  }
})
export default class MemberAdd extends Vue {
    isShowModel: boolean = false;
    departmentList:any=[]
    formItem:any={
        name:"",
        contact:"",
        telephone:"",
        address:"",
        department_name:""
    }
    mounted() {
      let vm: any = this;
      vm.isShowModel = true;
    }
    //关闭
  close() {
    let vm: any = this;
    let xwindow: any = window
    vm.isShowModel = false;
    if (!vm.clear) {
      xwindow.clearBodyStyle()
    }
    vm.$emit('close')
  }
  //确定
  async confirm() {
    let vm: any = this;
    let areaParams=vm.$refs.area.formInline;
    let param={...vm.formItem,...areaParams}
    console.log(param)
  }
    //获取部门
    async getDepartment(){   
      let vm:any = this;
      let params = {
        "range": [0, 10000],
      }
      let out:any = await getDepartmentList(params);
      if(!out.status){
        vm.departmentList=out.data.list || [];
        console.log(vm.departmentList)
      }
    }
}